<?php
error_reporting(0);
include_once '../comm/config.php';
include_once '../comm/checkpostandget.php';
include_once 'check.php';

$txje=$_POST['txje']; 
$zfb=$_POST['zfb1']; 
$ktx=$_POST['ktx']; 
$realname=$_POST['realname']; 
$mobile=$_POST['mobile'];
$password=$_POST['password']; 
if($txje<=0||$zfb==""){
	echo "<script language=javascript>window.location='error.php?id=6';</script>";
	exit;
}
$q = "SELECT * from ".$BIAOTOU."user where Id='".$_SESSION["dduserid"]."'";
$rs = mysql_query($q);
while ($row = mysql_fetch_array($rs)){
	$money=round($row["money"],2); 
	$realpass=$row["ddpassword"]; 
	$txstate=$row["txstate"]; 
	$ip=$_SERVER["REMOTE_ADDR"]; 
}
	//校验登录密码
if(md5($password)==$realpass){
	if($money<$txje){
		echo "<script language=javascript>window.location='error.php?id=7';</script>";
		exit;
	}
	else{
	    if($txstate==0){
			$sj= date("Y-m-d H:i:s");
			mysql_query("set names utf8");
			$insert = "INSERT into ".$BIAOTOU."tixian(ddusername,txje,zfb,addtime,addip,txstate,realname,mobile) values ('".$_SESSION['duoduouser']."','$txje','$zfb','$sj','$ip','0','".$realname."','".$mobile."')";
			mysql_query($insert);
			$up = "update ".$BIAOTOU."user set txstate=1,zfb='".$zfb."',tbusername='".$realname."',mobile='".$mobile."',lasttixian='".$sj."' where Id='".$_SESSION["dduserid"]."'";
			mysql_query($up);
			echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /><script language=javascript>alert('您的提现申请已经成功提交，我们将在24小时内处理完毕，请注意查收！');window.location='center.php';</script>";
			exit;
		}
		else{
			echo "<script language=javascript>window.location='error.php?id=12';</script>";
			exit;
		}
	} 
}
else{
	echo "<script language=javascript>window.location='error.php?id=14';</script>";
	exit;
}
mysql_close();
?>